﻿<Window
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:cal="clr-namespace:Caliburn.PresentationFramework.ApplicationModel;assembly=Caliburn.PresentationFramework" xmlns:PresentationFramework="clr-namespace:Caliburn.PresentationFramework;assembly=Caliburn.PresentationFramework" xmlns:local="clr-namespace:CI.Views" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" xmlns:Actions="clr-namespace:Caliburn.PresentationFramework.Actions;assembly=Caliburn.PresentationFramework" x:Class="CI.Views.ShellView"
             mc:Ignorable="d" 
             xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
			 WindowState="Maximized"
             d:DesignHeight="300" d:DesignWidth="400" Width="800" Height="600">
	<Window.Resources>
		<DataTemplate x:Key="SelectorWrapper">
            <Grid>
                <ContentControl cal:View.Model="{Binding}"/>
            </Grid>
        </DataTemplate>
		<Style x:Key="NoSelection_ListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
			<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
			<Setter Property="Padding" Value="2,0,0,0"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type ListBoxItem}">
						<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="SelectionStates">
									<VisualState x:Name="Unselected"/>
									<VisualState x:Name="Selected"/>
									<VisualState x:Name="SelectedUnfocused"/>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
						</Border>
						<ControlTemplate.Triggers>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</Window.Resources>
    <Grid dd:DragDrop.IsDropTarget="true" Background="White" dd:DragDrop.DropHandler="{Binding}">
    	<Grid.ColumnDefinitions>
    		<ColumnDefinition Width="Auto" MaxWidth="350"/>
    		<ColumnDefinition Width="*"/>
    	</Grid.ColumnDefinitions>
    	<Grid.RowDefinitions>
    		<RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
    		<RowDefinition Height="*"/>
    	</Grid.RowDefinitions>
        <Canvas Grid.Column="0" Grid.Row="0" Grid.RowSpan="4" Grid.ColumnSpan="2"/>
		<GridSplitter Width="3" ResizeDirection="Auto" HorizontalAlignment="Left" VerticalAlignment="Stretch" Grid.Column="1" Grid.Row="1"/>
        <ContentControl Grid.Row="1" cal:View.Model="{Binding Path=SheetsViewModel.CurrentSheet.Options}"/>
        <ContentControl Grid.Row="2" cal:View.Model="{Binding Path=SheetsViewModel.CurrentSheet.LayoutOptions}"/>
        <ListBox BorderBrush="Transparent" ScrollViewer.HorizontalScrollBarVisibility="Disabled" Grid.Row="3" Grid.Column="0" ItemsSource="{Binding SheetsViewModel.CurrentSheet.SelectorModels}" ItemTemplate="{DynamicResource SelectorWrapper}" HorizontalContentAlignment="Stretch" ItemContainerStyle="{DynamicResource NoSelection_ListBoxItemStyle}"/>
        <ContentControl cal:View.Model="{Binding Path=SheetsViewModel}" Grid.Row="1" Grid.Column="1" Grid.RowSpan="3"/>
    </Grid>
</Window>
